<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PassSupport</title>
    <link
      rel="shortcut icon"
      type="image/x-icon"
      href="/examples/public/favicon.ico"
    />
    <link rel="stylesheet" href="../css/common.css" />
  </head>

  <style>
    #app {
      width: 100%;
      height: 100%;
    }
  </style>

  <body>
    <div id="app"></div>

    <script type="module">
      import * as THREE from "three";
      import * as Vis from "../../dist/Vis.es.js";
      import { v4 as getUUid } from "uuid";

      const canvasGenerator = new Vis.CanvasGenerator({
        width: 256,
        height: 256,
      })
        .draw((ctx) => {
          ctx.textBaseline = "middle";
          ctx.textAlign = "center";

          ctx.fillStyle = "rgb(206, 42, 230)";

          ctx.font = " bold 68px 微软雅黑";
          ctx.fillText("PASS", 128, 128);
        })
        .preview();

      const engine = new Vis.ModelingEngineSupport()
        .setDom(document.getElementById("app"))
        .setSize()
        .setStats(true);

      const pointLight = Vis.generateConfig("PointLight", {
        position: {
          x: 30,
          y: 50,
        },
        distance: 100,
      });

      const material = Vis.generateConfig(Vis.CONFIGTYPE.MESHSTANDARDMATERIAL, {
        color: "red",
      });

      const geometry = Vis.generateConfig(Vis.CONFIGTYPE.SPHEREGEOMETRY, {
        radius: 10,
        widthSegments: 64,
        heightSegments: 64,
      });

      const mesh = Vis.generateConfig(Vis.CONFIGTYPE.MESH, {
        material: material.vid,
        geometry: geometry.vid,
      });

      const smaa = Vis.generateConfig(Vis.CONFIGTYPE.SMAAPASS);

      const unrealBloom = Vis.generateConfig(Vis.CONFIGTYPE.UNREALBLOOMPASS, {
        strength: 1,
      });

      const scene = Vis.generateConfig("Scene", {
        children: [pointLight.vid, mesh.vid],
      });

      engine.applyConfig(
        pointLight,
        material,
        geometry,
        mesh,
        smaa,
        unrealBloom,
        scene
      );

      engine.setScene(scene.vid).play();
      console.log(engine);
    </script>
  </body>
</html>
